function addInputGrid(obj,type,name)

% This file is part of CISNE.
%
%     CISNE is free software: you can redistribute it and/or modify
%     it under the terms of the GNU General Public License as published by
%     the Free Software Foundation, either version 3 of the License, or
%     any later version.
%
%     CISNE is distributed in the hope that it will be useful,
%     but WITHOUT ANY WARRANTY; without even the implied warranty of
%     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
%     GNU General Public License for more details.
%
%     You should have received a copy of the GNU General Public License
%     along with CISNE.  If not, see <http://www.gnu.org/licenses/>.

% Copyright 2011. Jose Maria Garcia-Valdecasas Bernal

model=get(obj.m_tree,'model');
root=obj.m_tree.Root();
for j=0:get(root,'ChildCount')-1
    child=root.getChildAt(j);
    kind=child.getValue();
    kind=char(kind(2));
    if (strcmp(kind,'INPUT'))
        %we add a new child in this node
        parent=child;
        child=uitreenode('v0',{'unselected',type},name,[], true);
        model.insertNodeInto(child,parent,parent.getChildCount());
        %generate data for propertygrid
        switch type
            case {'BATHYMETRY', 'VEGETATION', 'FRICTION'}
                obj.m_grids.(type)=...
            {'Xmin', 'Value of minimum X position', 'num',0;...
            'Ymin', 'Value of minimum Y position', 'num',0;...
            'X Step', 'Value of X axis step size', 'num',0;...
            'Y Step', 'Value of Y axis step size', 'num',0;...
            'Nx', 'number of elements in X axis', 'num',0;...
            'Ny', 'number of elements in Y axis', 'num',0;...
            'Angle', 'Angle formed between East and X axis', 'num',0;...
            'Header', 'number of header lines in file', 'num',0;...
            'Flip', 'Flip Y axis direction', 'bool',0;...
            'Swap', 'Swap elevation/depth values', 'bool',0;...
            'File', 'Name and path of file', 'file','';...
            'filetype','SWAN filetype','ftype',int32(1);...
            'Style','Drawing style','style','image';...
            'Opacity','Image opacity','slide',int32(100)};
        
            otherwise 
                obj.m_grids.(type)=...
            {'Xmin', 'Value of minimum X position', 'num',0;...
            'Ymin', 'Value of minimum Y position', 'num',0;...
            'X Step', 'Value of X axis step size', 'num',0;...
            'Y Step', 'Value of Y axis step size', 'num',0;...
            'Nx', 'number of elements in X axis', 'num',0;...
            'Ny', 'number of elements in Y axis', 'num',0;...
            'Angle', 'Angle formed between East and X axis', 'num',0;...
            'Header', 'number of header lines in file', 'num',0;...
            'Flip', 'Flip Y axis direction', 'bool',0;...
            'Swap', 'Swap elevation/depth values', 'bool',0;...
            'File', 'Name and path of Bathymetry file', 'file','';...
            'filetype','SWAN filetype','ftype',int32(1)};
            
        end
                
        obj.m_tree.setSelectedNode(child);
        
    end
end

end

